<?php /*a:2:{s:50:"D:\www\tp5\application\admin\view\article\add.html";i:1530871516;s:43:"D:\www\tp5\application\admin\view\base.html";i:1530096033;}*/ ?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>后台管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="/public/static/js/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/public/static/css/font-awesome.min.css">
    <!--CSS引用-->
    
    <link rel="stylesheet" href="/public/static/css/admin.css">
    <!--[if lt IE 9]>
    <script src="/public/static/css/html5shiv.min.js"></script>
    <script src="/public/static/css/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="layui-layout layui-layout-admin">
    <!--头部-->
    <div class="layui-header header">
        <span class="layui-header title"><?php echo htmlentities($site_config['site_title']); ?></span>
        <ul class="layui-nav" style="position: absolute;top: 0;right: 20px;background: none;">
            <!--<li class="layui-nav-item"><a href="" data-url="<?php echo url('admin/system/clear'); ?>" id="clear-cache">清除缓存</a></li>-->
            <li class="layui-nav-item">
                <a href="javascript:;"><?php echo cookie('admin_name'); ?></a>
                <dl class="layui-nav-child"> <!-- 二级菜单 -->
                    <dd><a href="<?php echo url('admin/change_password/index'); ?>">修改密码</a></dd>
                    <dd><a href="<?php echo url('admin/login/logout'); ?>">退出登录</a></dd>
                </dl>
            </li>
        </ul>
    </div>

    <!--侧边栏-->
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree">
                <li class="layui-nav-item layui-nav-title"><a>管理菜单</a></li>
                <li class="layui-nav-item">
                    <a href="<?php echo url('admin/index/index'); ?>"><i class="fa fa-home"></i> 网站信息</a>
                </li>
                <?php if(is_array($menu) || $menu instanceof \think\Collection || $menu instanceof \think\Paginator): if( count($menu)==0 ) : echo "" ;else: foreach($menu as $key=>$vo): if(isset($vo['children'])): ?>
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="<?php echo htmlentities($vo['icon']); ?>"></i> <?php echo htmlentities($vo['title']); ?></a>
                    <dl class="layui-nav-child">
                        <?php if(is_array($vo['children']) || $vo['children'] instanceof \think\Collection || $vo['children'] instanceof \think\Paginator): if( count($vo['children'])==0 ) : echo "" ;else: foreach($vo['children'] as $key=>$v): ?>
                        <dd><a href="<?php echo url($v['name']); ?>"> <?php echo htmlentities($v['title']); ?></a></dd>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </dl>
                </li>
                <?php else: ?>
                <li class="layui-nav-item">
                    <a href="<?php echo url($vo['name']); ?>"><i class="<?php echo htmlentities($vo['icon']); ?>"></i> <?php echo htmlentities($vo['title']); ?></a>
                </li>
                <?php endif; endforeach; endif; else: echo "" ;endif; ?>
            </ul>
        </div>
    </div>

    <!--主体-->
    
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class=""><a href="<?php echo url('admin/article/index'); ?>">文章列表</a></li>
            <li class="layui-this">添加文章</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form form-container" action="<?php echo url('admin/article/add'); ?>" method="post">
                    <input type="hidden" name="id" value="<?php echo empty($data['id'])?'':$data['id'];?>">
                    <div class="layui-form-item">
                        <label class="layui-form-label">* 标题</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" value="<?php echo empty($data['title'])?'':$data['title'];?>" lay-verify="required" autocomplete="off" placeholder="请输入标题" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">封面图</label>
                        <div class="layui-input-block">
                            <input type="hidden" name="cover_pic" value="<?php echo empty($data['cover_pic'])?'':$data['cover_pic'];?>">
                            <img src="<?php echo empty($data['cover_pic'])?'':$data['cover_pic'];?>" id="img" style="width: 150px; <?php if(empty($data['cover_pic'])){ echo 'display: none';};?>">
                            <button type="button" class="layui-btn" id="upload"><i class="layui-icon"></i>上传封面</button>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">自动封面</label>
                        <div class="layui-input-block">
                            <input type="checkbox" name="auto_cover" <?php if($data['auto_cover'] == 'on'){?>checked="";<?php }?> lay-skin="switch" lay-text="是|否">
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">* 摘要</label>
                        <div class="layui-input-block">
                            <textarea name="summary" lay-verify="required" placeholder="请输入摘要..." class="layui-textarea"><?php echo empty($data['summary'])?'':$data['summary'];?></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">* 内容</label>
                        <div class="layui-input-block">
                            <textarea id="default-template" name="body" lay-verify="required" placeholder="请输入内容..." class="layui-textarea"><?php echo empty($data['body'])?'':$data['body'];?></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit lay-filter="*" >保存</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>


    <!--底部-->
    <div class="layui-footer footer">
        <div class="layui-main">
            <p>2018-2018 &copy; <a href="#" target="_blank">管理后台</a></p>
        </div>
    </div>
</div>

<script>
    // 定义全局JS变量
    var GV = {
        current_controller: "admin/<?php echo htmlentities((isset($controller) && ($controller !== '')?$controller:'')); ?>/",
        base_url: "/public/static"
    };
</script>
<!--JS引用-->
<script src="/public/static/js/jquery.min.js"></script>
<script src="/public/static/js/layui/lay/dest/layui.all.js"></script>
<script src="/public/static/js/admin.js"></script>

<script src="/public/static/js/layui/layui.js"></script>
<script src="/public/static/js/ueditor/ueditor.config.js"></script>
<script src="/public/static/js/ueditor/ueditor.all.js"></script>

<!--页面JS脚本-->

<script>
    var ue = UE.getEditor('default-template');
    ue.ready(function() {
        ue.setHeight(350);
        $('.reset').on('click',function(){
            ue.setContent('');
            $('textarea[name="body"]').html('');
        })
    });


    layui.use('upload', function(){
        var $ = layui.jquery
            ,upload = layui.upload;
        //拖拽上传
        upload.render({
            elem: '#upload'
            ,url: '/index.php/api/upload/upload'
            ,done: function(res){
                console.log(res)
                if(res.error > 0){
                    return layer.msg('上传失败');
                }
                //上传成功
                $('#img').show();
                $('#img').attr("src",res.url);
                $("input[name='cover_pic']").val(res.url);
            }
        });
    });

</script>

</body>
</html>